{
    let EVENT_CLICK = Laya.Event.CLICK;

    class EnterRoom extends ui.Alert.EnterRoomUI {
        constructor () {
            super();

            this.name = "enter_roomid";
            this.default = [];
            this.curInputPos = -1;
            
            this.init();
        }

        init () {
            for(let i = 0; i < 8; i++){
                this.default.push({num : {visible : false, text : ""}, line : {visible : true}});
            }
            this.roomId.array = this.default;
            this.initEvent()
        }

        initEvent () {
            for(let i = 0; i < 10; i++){
                this[`key${i}`].on(EVENT_CLICK, this, this.onNumberClick, [`${i}`]);
            }

            this.btnReset.on(EVENT_CLICK, this, this.reset);
            this.btnDel.on(EVENT_CLICK, this, this.del);
        }

        del () {
            if(this.curInputPos < 0){
                this.curInputPos = -1;
                return;
            }
            this.roomId.changeItem(this.curInputPos, {num : {visible : false, text : ""}, line : {visible : true}});
            this.curInputPos--;
        }

        reset () {
            for(let i = 0; i < 8; i++){
                this.roomId.changeItem(i, {num : {visible : false, text : ""}, line : {visible : true}});
            }
            this.curInputPos = -1;
        }

        onNumberClick (num) {
            this.curInputPos++;
            this.roomId.changeItem(this.curInputPos, {num : {visible : true, text : num}, line : {visible : false}});
            
            if(this.curInputPos == 7){
                let roomId = "";
                for(let i = 0; i < 8; i++){
                    roomId += this.roomId.array[i].num.text;
                }
                Sail.io.emit("inputTeamNo", {teamNo : roomId});
            }
        }
    }

    Sail.class(EnterRoom, "Alert.EnterRoom");
}